﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MREO.data;

namespace MREO.gui
{
    public partial class fReports : Form
    {
        supportMethod supMeth = new supportMethod();

        public fReports()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            DateTime dateStart = dateTimePicker_start.Value;
            DateTime dateEnd = dateTimePicker_end.Value;

            try
            {
                dt = supMeth.getLogPrintData(dateStart, dateEnd);
            }
            catch (Exception exc) 
            {
                MessageBox.Show(exc.Message);
                return;
            }

            logReport rep = new logReport();
            rep.SetDataSource(dt);
            rep.SetParameterValue("dateStart",dateStart.Date.ToShortDateString());
            rep.SetParameterValue("dateEnd",dateEnd.Date.ToShortDateString());

            crystalReportViewer_main.ReportSource = rep;

        }
    }
}
